<template>
  <v-snackbar v-model="snackbar" app color="primary" top
    >{{ context }}

    <template v-slot:action="{ attrs }">
      <v-btn color="thirdary" text v-bind="attrs" @click="closeSnackerBar">
        确认登录
      </v-btn>
    </template>
  </v-snackbar>
</template>



<script>
import eventBus from "../../eventBus/eventBus";
export default {
  data() {
    return {
      snackbar: false,
      context: String,
    };
  },
  methods: {
    closeSnackerBar() {
      this.snackbar = false;
      eventBus.$emit("openLoginBox");
    },
  },
  mounted() {
    eventBus.$on("openSnackbar", (message) => {
      this.snackbar = true;
      this.context = message;
    });
  },
};
</script>



<style lang="scss" scoped>
</style>
